import JSEncrypt from "jsencrypt/bin/jsencrypt.min";

// 密钥对生成 http://web.chacuo.net/netrsakeypair

const publicKey =
  "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCNvtoiC2ukx/LvSV4YTNaGxUy9MHb+eu7ABUgi4WBaOyGC5SjHKFa9jC1xciyGyKdQwsRsHKtgdpfl+8rydnaypQcDAZOEAsZMHGNTHBPiLC3MwfVFxNTDHjczaBznscHGjCnsChnjfHZs+NukGYWriG9ymDS7REsVOV8tLwRPjwIDAQAB";

// 加密
export function encrypt(txt) {
  const encryptor = new JSEncrypt();
  encryptor.setPublicKey(publicKey); // 设置公钥
  return encryptor.encrypt(txt); // 对需要加密的数据进行加密
}
